/**
 * Project: push-center-biz-dal
 * 
 * File Created at 2014年10月9日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package com.greenline.push.dal.pushcenter.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.greenline.push.dal.base.BaseDAO;
import com.greenline.push.dal.pushcenter.MsgRetryFullDAO;
import com.greenline.push.dal.pushcenter.dataobject.MsgRetryDO;
import com.greenline.push.dal.query.MsgRetryQuery;

/**
 * @Type AppChannelDAOImpl
 * @Desc
 * @author zhaoli
 * @date 2014年10月9日
 * @Version V1.0
 */
public class MsgRetryFullDAOImpl extends BaseDAO implements MsgRetryFullDAO {

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.AppChannelDAO#insert(com.greenline.
     * push.dal.pushcenter.dataobject.AppChannelDO)
     */
    @Override
    public Long insert(MsgRetryDO msgRetryDO) {
        return (Long) super.getSqlMapClientTemplate().insert("msgRetryFull.insert", msgRetryDO);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.AppChannelDAO#getAppChannelById(java
     * .lang.Long)
     */
    @Override
    public MsgRetryDO getById(Long id) {
        return (MsgRetryDO) super.getSqlMapClientTemplate().queryForObject("msgRetryFull.find_by_id", id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.AppChannelDAO#update(com.greenline.
     * push.dal.pushcenter.dataobject.AppChannelDO)
     */
    @Override
    public int update(MsgRetryDO msgRetryDO) {
        return super.getSqlMapClientTemplate().update("msgRetryFull.update", msgRetryDO);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.AppChannelDAO#listByQuery(com.greenline
     * .push.dal.query.AppChannelQuery)
     */
    @Override
    public MsgRetryQuery listByQuery(MsgRetryQuery query) {
        return (MsgRetryQuery) super.listByQuery("msgRetryFull.list_by_query", query);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.AppChannelDAO#delete(java.lang.Long)
     */
    @Override
    public int delete(Long id) {
        return super.getSqlMapClientTemplate().delete("msgRetryFull.delete", id);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<MsgRetryDO> listByExample(MsgRetryDO msgRetryDO) {
        return getSqlMapClientTemplate().queryForList("msgRetryFull.find_by_example", msgRetryDO);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<MsgRetryDO> fetchMsgList(Long startId, Integer count, String appChannel) {
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("startId", startId);
        param.put("count", count);
        param.put("appChannel", appChannel);
        return getSqlMapClientTemplate().queryForList("msgRetryFull.fetch_msg_list", param);
    }

    @Override
    public void updateAllSendStatus() {
        getSqlMapClientTemplate().update("msgRetryFull.update_all_send_status");
    }

    @Override
    public int batchInsert(List<MsgRetryDO> msgRetryList) {
        return getSqlMapClientTemplate().update("msgRetryFull.batch_insert", msgRetryList);
    }

}
